import React, { useState } from "react";
import styles from './index.module.less'
import { Checkbox } from "antd";
const checkbox = () => {
    const options = ['Orange','Blue','Green','Yellow']
    const [checkList, setCheckList] = useState<string[]>([])
    return <div className={styles.checkbox}>
        <Checkbox
            checked={checkList.length === options.length}
            indeterminate={checkList.length > 0 && checkList.length < options.length}
            onChange={(e) => {
                setCheckList(e.target.checked ? options : [])
            }}>{'全选'}</Checkbox>
        <Checkbox.Group options={options} value={checkList} onChange={(list) => setCheckList(list)} />
    </div>
}

export default checkbox